package org.example.smartbuy.serviceImpl;

import org.example.smartbuy.entity.Payments;
import org.example.smartbuy.mapper.PaymentsMapper;
import org.example.smartbuy.service.IPaymentsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Smarty Buy
 * @since 2024-11-18
 */
@Service
public class PaymentsServiceImpl extends ServiceImpl<PaymentsMapper, Payments> implements IPaymentsService {

    @Autowired
    private PaymentsMapper paymentsMapper;

    @Override
    public List<Payments> listAll() {
        return paymentsMapper.selectList(null);
    }

    @Override
    public Payments getById(int id) {
        return paymentsMapper.selectById(id);
    }

    @Override
    public Payments add(Payments payments) {
        paymentsMapper.insert(payments);
        return payments;
    }

    @Override
    public void delete(int id) {
        paymentsMapper.deleteById(id);
    }
}
